hysop.tools.profiler module

Tools to collect time profiling information for hysop classes.

class hysop.tools.profiler.FProfiler(fname)[source]

Bases: object

Class for time measurments on the fly. The objects can be linked to a class method.

Object to profile on the fly sections of code, methods …

Usage:

>>> from hysop.tools.profiler import FProfiler
>>> from hysop.core.mpi import Wtime as ftime
>>> prof = FProfiler('some_name')
>>> start = ftime()
>>> # do something ... [1]
>>> prof += ftime() - start
>>> # do something else ... [2]
>>> prof += ftime() - start
>>> # ...
>>> # print(prof)
>>> # --> display total time spent in do [1] and [2]
>>> # and number of calls of prof
__iadd__(t)[source]

+= operator

get()[source]
get_name()[source]

Profiler name

class hysop.tools.profiler.Profiler(obj)[source]

Bases: object

Object used to collect profiling information inside operators.

Collect profiling information for all operator method decorate with @profile.

Parameters:
  • obj (object (python class) instance. See requirements in notes below.)

  • Notes

  • 'name' (* obj must have '_get_profiling_info' and)

  • attribute/method.

__iadd__(other)[source]

+= operator. Append a new profiled function to the collection

down(l)[source]
get_comm()[source]

Return the communicator associated to the profiled object

get_name()[source]

Return the name of the profiled object

summarize()[source]

Update profiling values and prepare data for a report with print or write.

tasks_summarize()[source]

Collect all profiling data across processes.

write(prefix='', hprefix='', with_head=True)[source]
Parameters:
  • prefix (string, optional)

  • hprefix (string, optional)

  • with_head (bool, optional)